using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SitesLiberation.main.imprt
{
public class LibMain {

  
//  @Option(name="-u", usage="username with which to authenticate")
  private string username = null;
  
  // @Option(name="-p", usage="password with which to authenticate")
  private string password = null;
  
  // @Option(name="-d", usage="domain of site")
  private string domain = null;
  
  // @Option(name="-w", usage="webspace of the site")
  private string webspace = null;
  
  // @Option(name="-f", usage="directory from which to import")
  private string directory = new File("");
  
  // @Option(name="-h", usage="host")
  private string host = "sites.google.com";
  
  // @Option(name="-r", usage="import revisions")
  private bool importRevisions = false;
  
  private void doMain(string[] args) {

      /*
    CmdLineParser parser = new CmdLineParser(this);
    Injector injector = Guice.createInjector(new SiteImporterModule());
    SiteImporter siteImporter = injector.getInstance(SiteImporter.class);
    try {
      parser.parseArgument(args);
      if (webspace == null) {
        throw new CmdLineException("Webspace of site not specified!");
      }
      if (username == null) {
        throw new CmdLineException("Username not specified!");
      }
      if (password == null) {
        throw new CmdLineException("Password not specified!");
      }
      if (!username.contains("@") && domain != null) {
        username += '@' + domain;
      }
      SitesService sitesService = new SitesService("google-sites-liberation");
      sitesService.setUserCredentials(username, password);
      siteImporter.importSite(host, domain, webspace, importRevisions, 
          sitesService, directory, new StdOutProgressListener());
    } catch (CmdLineException e) {
      LOGGER.log(Level.SEVERE, e.getMessage());
      parser.printUsage(System.err);
      return;
    } catch (ServiceException e) {
      LOGGER.log(Level.SEVERE, "Invalid User Credentials!");
      throw new RuntimeException(e);
    }
  }
  
  /**
   * Imports a Site.
   */
  public static void main(string[] args) {
    new Main().doMain(args);
  }
}
